package com.powernode.feign.fallbackfactory;

import com.powernode.domain.Sku;
import com.powernode.feign.CartProductFeign;
import com.powernode.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @create: 2024/7/25
 * @author: gyhe10
 * @description:
 **/

@Component
@Slf4j
public class CartProductFeignFallbackFactory implements FallbackFactory<CartProductFeign> {
    @Override
    public CartProductFeign create(Throwable cause) {
        return new CartProductFeign() {
            @Override
            public Result<List<Sku>> getSkuListByIds(List<Long> skuIdList) {
                log.error("调用商品服务接口失败：根据skuId集合查询sku对象集合，原因：{}", cause.getMessage());
                return null;
            }
        };
    }
}
